<?php
/*
Autor: Marek Křivan
(c) 2009 
*/
if(intval($_SESSION['rank']) < 2){
	exit(WRONG_PERMISSIONS);
}
$id_tematu = 1 * $q[2];
if((isset($_POST['editovat_titulek'])) && ($_SESSION['rank'] >= 2)) {
                //$edit_titulek = orez_retezec_2($_POST['edit_titulek']);
                $edit_titulek = $GLOBALS['db']->real_escape_string($_POST['edit_titulek']);
                $query = $GLOBALS['db']->query("UPDATE " . $GLOBALS['db_prefix'] ."forum_temata SET jmeno = '".$edit_titulek."' WHERE id = '".$id_tematu."';") or die('chyba !');
                $seo = ($GLOBALS['seo']) ? '' : 'index.php?q=';
                echo "<meta http-equiv=\"refresh\" content=\"1;".$GLOBALS['url']. $seo ."forum/dues/".$id_tematu."/".$q[3]."\" />";
        } else
        if($_SESSION['rank'] >= 2) {
                $query = $GLOBALS['db']->query("SELECT jmeno FROM " . $GLOBALS['db_prefix'] ."forum_temata WHERE id = '$id_tematu';");
               $edit = $query->fetch_array();
                echo "<form action=\"".$GLOBALS['url']."index.php?q=forum/edit_titulek/".$id_tematu."/$q[3]\" method=\"post\"><fieldset><legend>Přejmenovat téma</legend><label>Titulek tématu: </label><input type=\"text\" name=\"edit_titulek\" value=\"".$edit['jmeno']."\" /><br /><br /><input type=\"submit\" name=\"editovat_titulek\" value=\"Přejmenovat\"><br /><br /></fieldset></form>";
        }
?>
